<?php


namespace App\Http\Controllers\admin\api;


use App\Http\Controllers\admin\service\AppService;
use App\Http\Controllers\admin\validate\App;
use App\Http\Controllers\utils\ToolUtil;
use Illuminate\Http\Request;

class AppApi
{
    public function uploadApp(Request $request){
        $param = $request->all();
        $data = App::uploadApp($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return AppService::uploadApp($param);
    }

    public function addApp(Request $request){
        $param = $request->all();
        $data = App::addApp($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return AppService::addApp($param);
    }
    
    public function queryAdminAppList(Request $request){
        $param = $request->all();
        $data = App::queryAdminAppList($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return AppService::queryAdminAppList($param);
    }

    public function queryIdAdminAppList(Request $request){
        $param = $request->all();
        $data = App::queryIdAdminAppList($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return AppService::queryIdAdminAppList($param);
    }

    public function installAdminApp(Request $request){
        $param = $request->all();
        $data = App::installAdminApp($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return AppService::installAdminApp($param);
    }

    public function getGradeName(){
        return AppService::getGradeName();
    }

    public function deleteApp(Request $request){
        $param = $request->all();
        $data = App::deleteApp($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return AppService::deleteApp($param);
    }

    public function queryIdApp(Request $request){
        $param = $request->all();
        $data = App::queryIdApp($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return AppService::queryIdApp($param);
    }

    public function editApp(Request $request){
        $param = $request->all();
        $data = App::editApp($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return AppService::editApp($param);
    }

    public function queryAdminApp(Request $request){
        $param = $request->all();
        $data = App::queryAdminApp($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return AppService::queryAdminApp($param);
    }

    public function queryTeacherApp(Request $request){
        $param = $request->all();
        $data = App::queryTeacherApp($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return AppService::queryTeacherApp($param);
    }

    public function queryParentApp(Request $request){
        $param = $request->all();
        $data = App::queryParentApp($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return AppService::queryParentApp($param);
    }

    public function queryBatchName(Request $request){
        $param = $request->all();
        $data = App::queryBatchName($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return AppService::queryBatchName($param);
    }

    public function queryGradeName(Request $request){
        $param = $request->all();

        return AppService::queryGradeName($param);
    }

    public function uploadPreviewImg(Request $request){
        $param = $request->all();
        $data = App::uploadPreviewImg($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return AppService::uploadPreviewImg($param);
    }

    public function querySubjectName(Request $request){
        $param = $request->all();
        return AppService::querySubjectName($param);
    }

    public function addAppUpdate(Request $request){
        $param = $request->all();
        $data = App::addAppUpdate($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return AppService::addAppUpdate($param);
    }

    public function queryAppUpdate(Request $request){
        $param = $request->all();
        $data = App::queryAppUpdate($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return AppService::queryAppUpdate($param);
    }

    public function queryIdAppUpdate(Request $request){
        $param = $request->all();
        $data = App::queryIdAppUpdate($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return AppService::queryIdAppUpdate($param);
    }

    public function updateAppUpdate(Request $request){
        $param = $request->all();
        $data = App::updateAppUpdate($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return AppService::updateAppUpdate($param);
    }

    public function deleteAppUpdate(Request $request){
        $param = $request->all();
        $data = App::deleteAppUpdate($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return AppService::deleteAppUpdate($param);
    }

    public function addAppTest(Request $request){
        $param = $request->all();
        $data = App::addAppTest($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return AppService::addAppTest($param);
    }

    public function queryAppTest(Request $request){
        $param = $request->all();
        $data = App::queryAppTest($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return AppService::queryAppTest($param);
    }

    public function deleteAppTest(Request $request){
        $param = $request->all();
        $data = App::deleteAppTest($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return AppService::deleteAppTest($param);
    }

    public function packageNameQuerySn(Request $request){
        $param = $request->all();
        $data = App::packageNameQuerySn($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return AppService::packageNameQuerySn($param);
    }

    public function addSysApp(Request $request){
        $param = $request->all();
        $data = App::addSysApp($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return AppService::addSysApp($param);
    }

    public function querySysApp(Request $request){
        $param = $request->all();
        $data = App::querySysApp($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return AppService::querySysApp($param);
    }

    public function queryIdSysApp(Request $request){
        $param = $request->all();
        $data = App::queryIdSysApp($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return AppService::queryIdSysApp($param);
    }

    public function editSysApp(Request $request){
        $param = $request->all();
        $data = App::editSysApp($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return AppService::editSysApp($param);
    }

    public function deleteSysApp(Request $request){
        $param = $request->all();
        $data = App::deleteSysApp($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return AppService::deleteSysApp($param);
    }
}